<script setup lang="ts">
import { ref } from 'vue';
import SonSon from './SonSon.vue';
interface Person {
  name: string;
  age: number;
}
// const list = defineProps<Person[]>()
const props = defineProps<{ list: Person[] }>();
const title = '这是子组件'
const emits = defineEmits<{
  'leftButtonClick': [list: Person[]]
}>()
</script>
<template>

  <h1>这是子组件</h1>
  <div v-for="item in props.list">
    <p>姓名：{{ item.name }}</p>
    <p>年龄：{{ item.age }}</p>
  </div>
  <button @click="emits('leftButtonClick', list)">点击左边按钮</button>
  <SonSon></SonSon>
  <slot></slot>
</template>
<style scoped>
h1 {
  color: red;
}

p {
  color: blue;
  font-size: 18px;
  margin: 0;
  padding: 0;
  text-align: center;
  line-height: 1.5;
  font-weight: bold;
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 1px 1px 1px #000;
  background-color: #f2f2f2;
  border-radius: 5px;
  box-shadow: 2px 2px 2px #888888;
  transition: all 0.3s ease-in-out;
}
</style>